import json
import base64


def _decode(jws_str):
    """
    :param jws_str: 字符串，格式为：<header>.<payload>.<signature>
    :return: dict
    """
    payload = jws_str.split('.')[1]

    mod = len(payload) % 4
    if mod:
        payload += '=' * (4 - mod)

    byte_data = base64.decodebytes(payload.encode())
    return json.loads(byte_data)
